import json

from django.http import HttpResponse, JsonResponse
from django.shortcuts import render
from django.views import View

from book.models import PeopleInfo


# Create your views here.

def index(request):
    roles=PeopleInfo.objects.filter(book__name='笑傲江湖')
    return HttpResponse([i for i in roles])

def goods(request):
    jdata=request.body
    json_str = jdata.decode()
    print(json_str)
    response=HttpResponse(json_str,status=300)
    response.set_cookie("nihao","liu")

    return response


class LoginView(View):
    def get(self, request):
        return HttpResponse("get get get")

    def post(self, request):
        return HttpResponse("post post")
